home *** CD-ROM | disk | FTP | other *** search
/ PC Graphics Unleashed / PC Graphics Unleashed.iso / xb / tiff256.txt < prev   
Text File  |  1994-07-29  |  58KB  |  1,376 lines

  1.  
  2.                                 
  3.                                 
  4.                                 
  5.                                 
  6.                                 
  7.                                 
  8.                                 
  9.                                 
  10.                                 
  11.                                 
  12.                                TIFF256
  13.                           Graphics Library
  14.                              Extensions
  15.                                   
  16.                           For C Programmers
  17.                                   
  18.                              Version 3.0
  19.                             July 28, 1994
  20.                                   
  21.                                   
  22.                  Copyright Spyro Gumas, 1992 - 1994.
  23.                          All Rights Reserved
  24.                                   
  25.                                   
  26.                                   
  27.                                   
  28.                                   
  29.                                   
  30.                  Look what You get for Registering!!
  31.  
  32.           -    Royalty Free Use of TIFF256 in Your Programs!
  33.           -    3D Graphics Library!
  34.           -    Graphics Mouse Library!
  35.           -    Joystick Library & Source Code!
  36.           -    Image Processing Library & Source Code!
  37.           -    Graphical User Interface Library & Source Code
  38.           -    32 Bit WATCOM C Compiler compatible library!
  39.           -    On line support through CompuServe!
  40.           -    Printed Users Manual and Software Disk!
  41.           -    Half Price upgrade to next version!
  42.  
  43.                     (See Page 6 for Details)
  44.                                 
  45.                                 
  46.                                 
  47.                                 
  48.                                 
  49.                                 
  50.                                 
  51.                                 
  52.  
  53.                                 
  54.                                 Page: 1
  55.                                    
  56. 1.0 Introduction                                       3
  57.   1.1 Revision History                                 4
  58.   1.2 Benefits of Registering                          6
  59.   1.3 Distribution Files                               7
  60.   1.4 Some TIFF Insight                                7
  61. 2.0 The TIFF256 Extensions Environment                 8
  62.   2.1 Using The TIFF256 Extensions                     8
  63.   2.2 Global Graphics Parameters                       8
  64.   2.3 Compiler Compatibility                           9
  65.   2.4 Support of TIFF 5.0                              9
  66. 3.0 TIFF256 Extensions Functionality                   12
  67.   3.1 Handling The Color Look Up Table                 12
  68.   3.2 Function Descriptions                            13
  69.      3.2.1 tf_set_true_color_mode                      13
  70.      3.2.2 tf_get_true_color_mode                      14
  71.      3.2.3 tf_open_file                                14
  72.      3.2.4 tf_close_file                               14
  73.      3.2.5 tf_get_file_info                            15
  74.      3.2.6 tf_skip_ifd                                 15
  75.      3.2.7 tf_set_defaults                             16
  76.      3.2.8 tf_read_ifd                                 16
  77.      3.2.9 tf_display_ifd                              17
  78.      3.2.10 tf_save_file                               18
  79.      3.2.11 tf_image_size                              19
  80.      3.2.12 tf_load_image                              19
  81.      3.2.13 tf_save_image                              20
  82.      3.2.14 tf_set_prime_colors                        21
  83. 4.0 Nitty Gritties                                     22
  84.   4.1 Registration Information                         22
  85.   4.2 Software License                                 23
  86.   4.3 Disclaimer                                       24
  87.   4.4 Technical Support                                24
  88. 5.0 Appendix                                           25
  89.   5.1 TIFF.H Include File                              25
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.                                 Page: 2
  110.                                    
  111. 1.0 Introduction
  112.  
  113.      The TIFF256 Graphics Library Extensions Version 3.0 is a library 
  114. of  C routines which extend the capabilities of the VSA256 Graphics 
  115. Library.  With TIFF256 the C programmer has the tools necessary to 
  116. read, display, and write Tagged Image File Format (TIFF) images using 
  117. a 256 color video adapter running with the VESA BIOS Extensions.  
  118. Support is provided for both Microsoft C and Borland C products.  The
  119. name "TIFF256" reflects the fact that this library supports the 256 
  120. color video modes defined within the VESA standard.
  121.      As the preeminent graphics format, TIFF images have permeated the 
  122. fiber of  the computer world.  It is the single most common file format 
  123. supported by virtually all hand held and flat bed scanners.  While every 
  124. major computer platform has evolved its own unique image file format, 
  125. TIFF is the one standard format which crosses the boundaries between PC, 
  126. MAC, Silicon Graphics, Sun, HP, DEC, and all the rest.
  127.      The TIFF256 Graphics Library Extensions lets you take advantage of 
  128. TIFF's popularity by letting you integrate TIFF capability into your 
  129. graphical application.  While powerful and robust, the TIFF256 library 
  130. is simple to use.  Only a few lines of code are required to get a TIFF 
  131. image up on the screen.  One more line of code and the image is saved.  
  132. (By the way, have you ever tried to write out a BMP image under Windows? 
  133. ... Good night Eunice!)  A few more lines of code and you can customize 
  134. how the software displays 24 bit/pixel images on your 256 color display, 
  135. selecting between 332 RGB, Dithered, or Adaptive Palette displays.  The 
  136. VSA256 / TIFF256 combination gives you a formidable tool for graphical 
  137. programming while sparing you the nightmare of Windows programming.
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.                                 Page: 3
  165.                                    
  166. 1.1 Revision History
  167.  
  168. -Version 1.0 is the original SHAREWARE version of the TIFF256 Graphics
  169. Library Extensions.
  170.  
  171. -Version 2.0b is the REGISTERED version of the TIFF256 Graphics
  172. Library Extensions.  Whereas the TIFF256 Graphics Library Extensions
  173. Version 1.x is shareware, Version 2.0b IS NOT shareware and may only
  174. be used in accordance with the terms of the purchase agreement.  The
  175. major change between version 1.0 and 2.0b is the addition of the
  176. routine called  tf_save_file.  With this one new routine, the
  177. programmer may now create a TIFF file from any image generated using
  178. the VSA256 Graphics Library and the TIFF256 Graphics Library
  179. Extensions.
  180.  
  181. -Version 3.0 is presented to the general public in the true spirit of
  182. shareware.  This revision is the full-up version of the  TIFF256
  183. Graphics Library Extensions.  I  no longer maintain a separate
  184. registered version of this library.  Version 3.0 of the TIFF256
  185. Graphics Library Extensions is presented as Shareware with high hopes
  186. that the programmers who use this library will feel good about
  187. sending in the registration fee of $29.  The major changes between
  188. version 2.0b and 3.0 are listed below:
  189.  
  190.   **Added Adaptive Palette - Now the programmer has the option to turn
  191.   on Adaptive Palette during the 24 bits/pixel to 8 bits/pixel color
  192.   reduction.  The Adaptive Palette feature calculates the optimum
  193.   color palette for each True Color image.  The result is that the
  194.   most reduced images retain their True Color look.
  195.  
  196.   **Added Dithering - The programmer has the option to turn on dithering 
  197.   during the 24 bits/pixel to 8 bits/pixel color reduction.  Dithering 
  198.   approximates the full 16 million color spectrum on 256 color systems 
  199.   through a technique of jittering or dithering pixel intensities. This 
  200.   technique is particularly useful when a good adaptive palette can not 
  201.   be generated.
  202.  
  203.   **New routine, tf_set_true_color_mode - Used to select 8 bit RGB, 
  204.   Dithering, or Adaptive Palette for True Color images and to define 
  205.   the Adaptive Palette configuration.
  206.  
  207.   **New routine, tf_get_true_color_mode - Used to get current True 
  208.   Color display mode and Adaptive Palette configuration parameters.
  209.  
  210.   **New routine, tf_image_size - Used to get the size of an image for
  211.   use with next two functions.
  212.  
  213.   **New routine, tf_load_image - Now you can read a TIFF file directly
  214.   into an memory buffer instead of having to display it on the screen
  215.   first.  Use vsa_put_image to display it on the screen when you are
  216.   ready.
  217.  
  218.  
  219.                                 Page: 4
  220.                                    
  221.   **New routine, tf_save_image - With this function you can save an
  222.   image already in a memory buffer to a TIFF file.  You can use
  223.   vsa_get_image to copy screen image into memory buffer.
  224.  
  225.   **Clipping when TIFF image displayed on screen - This is an outcome
  226.   of the VSA256 Graphics Library 3.0 upgrade which added clipping.
  227.   You no longer have to worry about your images screen wrapping.
  228.  
  229.   **Fixed "unresolved external _fstrlen" linker error with Turbo C.
  230.   
  231.   **Made all functions in TIFF.H external, no more "Multiple
  232.   Declaration" warnings.
  233.  
  234.   **Changed name of tf_display_image to tf_display_ifd - Since
  235.   tf_load_image, tf_save_image, vsa_get_image, and vsa_put_image all
  236.   use 'image' in the context of a memory buffer, consistency demands
  237.   this change.  tf_display_ifd doesn't deal with memory buffers but
  238.   goes straight from a TIFF file to the screen.  For compatibility
  239.   with older versions, tf_display_image in old code automatically
  240.   gets mapped to a call to tf_display_ifd.
  241.  
  242.   **Turned off automatic error message screen output - Now the
  243.   application can decide whether or not it wants an error message
  244.   actually displayed by interpreting the return values of the
  245.   relevant functions.
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.   
  270.  
  271.  
  272.  
  273.  
  274.                                 Page: 5
  275.                                    
  276. 1.2 Benefits of Registering
  277.  
  278.      If you use this program beyond an initial evaluation period, you
  279. must register your use with a $29 remittance to the author .. me ($15
  280. if ordering VSA256 and TIFF256 at the same time, see ORDER.TXT).  In
  281. addition to the good feeling that you get for sustaining a late night
  282. hacking obsession, you get the following benefits for registering:
  283.  
  284. 1)        Royalty Free Use of TIFF256 in Your Programs! Feel free to
  285.           distribute your programs for profit with no royalty fees.
  286.           See section 4.2.
  287.  
  288. 2)        3D Graphics Library!   Don't live in a flat world.  Add the
  289.           missing 3rd dimension to your creations.  This library lets
  290.           you create 3d objects, set your view point, and perform 3d
  291.           transformations including scale, offset, and rotation.
  292.           Supports wireframe, solid, and Gouraud shaded objects.
  293.  
  294. 3)        Graphics Mouse Library!   Use this library to integrate
  295.           Mouse input with your graphics applications.  Get precise
  296.           updates of mouse position, update screen cursor, read mouse
  297.           buttons, and more.  Invent your own graphical user
  298.           interface, give your apps that professional feel, have tons
  299.           of fun!
  300.  
  301. 4)        Joystick Library with Source Code!   Integrate Joystick
  302.           input with your graphics applications.  Write a flight
  303.           simulator, boat driver, or your own unique use of this
  304.           agile input device.
  305.  
  306. 5)        IMP256 Image Processing Library and Source Code!  With this
  307.           library you can learn all about image sharpening,
  308.           embossing, blurring, color balancing, and enhancement.
  309.  
  310. 6)        32 Bit WATCOM C Compiler compatible VSA256 and TIFF256
  311.           libraries!  Get the edge on performance.
  312.  
  313. 7)        On line support through CompuServe.
  314.  
  315. 8)        Printed Users Manual and Current Version Software on Disk.
  316.  
  317. 9)        One Half Price Upgrade to the next version, as it becomes
  318.           available.
  319.                                   
  320.                                  AND
  321. 10)       The following public domain full color TIFF image files to
  322.           get you started:
  323.                          VENUS.TIF
  324.                          EARTH.TIF
  325.                          MOON.TIF
  326.                          MARS.TIF
  327.                          SATURN.TIF
  328.  
  329.                                 Page: 6
  330.                                    
  331.                          NEPTUNE.TIF
  332.                          SHUTTLE.TIF
  333.                          ASTRONTS.TIF
  334.                          WEATHER.TIF
  335.                          MANDRILL.TIF
  336.  
  337. 1.3 Distribution Files
  338.  
  339.      The distribution of the TIFF256 Graphics Library Extensions
  340. Version 3.0 consists of the 8 files listed below.  These files are
  341. archived in the file TIF256.ZIP.  To extract, just type 'PKUNZIP
  342. TIF256' in the directory that you want the files extracted to.
  343.  
  344. TIF_DEMO.C     Demonstration program (Source Code).
  345. TIF_DEMO.EXE   Demonstration program (Executable).
  346. TIF_DATA.EXE   TIFF file analysis program (Executable).
  347. TIFFMSL.LIB    TIFF256 Extensions, Large Memory Model (Microsoft C).
  348. TIFFBCL.LIB    TIFF256 Extensions, Large Memory Model (Borland C).
  349. TIFF.H         Include file required in your program.
  350. TIFF256.TXT    This text document.
  351. ORDER.TXT      A text file order form for upgrades and registration.
  352.  
  353. 1.4 Some TIFF Insight
  354.  
  355.      A TIFF file can contain one or more images.  Each of these
  356. images is stored in the file as an "Image File Directory" (an IFD).
  357. Each IFD consists of numerous fields or "tags".  Each tag defines a
  358. particular aspect of the image (i.e. color model, width, length,
  359. resolution, etc.).  With the TIFF256 Extensions, a programmer can
  360. find out how many IFDs are contained within a TIFF file, jump to the
  361. desired IFD, read all of the tags within the IFD, and display the
  362. IFD's image.
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.                                 Page: 7
  385.                                    
  386. 2.0 The TIFF256 Extensions Environment
  387.  
  388. 2.1 Using The TIFF256 Extensions
  389.  
  390.      The TIFF256 Extensions work with any (any?) IBM PC, XT, AT or
  391. compatible computer equipped with a VESA compatible SVGA video
  392. adapter card capable of 256 colors.  Most  of the video cards sold
  393. today are VESA compatible with the VESA BIOS built in to the card.
  394. For older SVGA video cards which are not VESA compatible, the VESA
  395. BIOS Extensions must be loaded as a Terminate and Stay Resident (TSR)
  396. program before using the TIFF256 Extensions.  A math coprocessor chip
  397. is not required.  The TIFF256 Extensions are distributed as a Large
  398. Memory Model library for either Microsoft C or Borland C.  If other
  399. memory models are required, contact me.
  400.      The TIFF256 Extensions Version 3.0 are used in conjunction with
  401. the VSA256 Graphics Library Version 3.0.  The following discussion
  402. assumes that you are adding TIFF capability to an existing program
  403. which already uses the VSA256 Graphics Library.  To use the TIFF256
  404. Extensions, add the file TIFF.H to your C compiler's default
  405. directory for INCLUDE files, add the statement:
  406.  
  407.                           #include<tiff.h>;
  408.  
  409. to your program, and add the file TIFFBCL.LIB or TIFFMSL.LIB to the
  410. list of files that your program is linked with.
  411.  
  412. 2.2 Global Graphics Parameters
  413.  
  414.      The file TIFF.H is used as an include file during program
  415. development.  This file includes all of the extension's function
  416. prototypes and it defines the global parameters that describe the
  417. TIFF File and individual IFDs.  The global graphics parameters are
  418. initialized by the tf_get_file_info() and tf_read_ifd() functions and
  419. are described below:
  420.  
  421. TF_Num_Ifd:           Unsigned, the number of IFDs in the TIFF file.
  422. TF_ImageWidth:        Unsigned long, the image width in pixels.
  423. TF_ImageLength:       Unsigned long, the image length in pixels.
  424. TF_BitsPerSample[3]:  Unsigned, the number of bits per sample.
  425.                       For Bilevel, grayscale, or Palette Color, pixel
  426.                       size = TF_BitsPerSample[0].  For True Color,
  427.                       pixel Red Component = TF_BitsPerSample[0], pixel
  428.                       Green component = TF_BitsPerSample[1], pixel Blue
  429.                       component = TF_BitsPerSample[2].
  430. TF_ResolutionUnit:    Unsigned, 1 = Not specified, 2 = Inch, 3 =
  431.                       Centimeter.
  432. TF_SamplesPerPixel:   Unsigned, the number of samples per pixel.
  433. TF_PhotometricInterpretation:  Unsigned, 1 = Bilevel or Grayscale, 2
  434.                       = RGB (True Color) image, 3 = Palette Color Image.
  435.  
  436.  
  437.  
  438.  
  439.                                 Page: 8
  440.                                    
  441. TF_XResolution_int:   Unsigned long, the integral number of pixels in
  442.                       the x dimension per TF_ResolutionUnit.
  443. TF_XResolution_frac:  Unsigned long, the fractional number of
  444.                       pixels in the x dimension per TF_ResolutionUnit.
  445. TF_YResolution_int:   Unsigned long, the integral number of pixels in
  446.                       the y dimension per TF_ResolutionUnit.
  447. TF_YResolution_frac:  Unsigned long, the fractional number of
  448.                       pixels in the y dimension per TF_ResolutionUnit.
  449. TF_Black:       Unsigned, index into CLUT for color nearest to black.
  450. TF_Red:         Unsigned, index into CLUT for color nearest to Red.
  451. TF_Orange:      Unsigned, index into CLUT for color nearest to Orange.
  452. TF_Yellow:      Unsigned, index into CLUT for color nearest to Yellow.
  453. TF_Green:       Unsigned, index into CLUT for color nearest to Green.
  454. TF_Aqua:        Unsigned, index into CLUT for color nearest to Aqua.
  455. TF_Blue:        Unsigned, index into CLUT for color nearest to Blue.
  456. TF_Violet:      Unsigned, index into CLUT for color nearest to Violet.
  457. TF_White:       Unsigned, index into CLUT for color nearest to White.
  458.  
  459. 2.3 Compiler Compatibility
  460.  
  461.      The TIFFMSL.LIB was compiled using Microsoft's Quick C 2.5 and
  462. it seems to also work well with Microsoft C 6.0 and 7.0.  I have
  463. received reports of compatibility problems with Microsoft C 5.0.
  464.      The TIFFBCL.LIB was compiled using Borland's C/C++ 3.1 and it
  465. seems to also work well with Borland C/C++ 3.0 and 4.0.  I have
  466. received conflicting reports of compatibility problems with Borland's
  467. Turbo C 2.0 and 3.0.
  468.      I appreciate any feedback that programmers send me along these
  469. lines so that I can continue to improve this product.
  470.  
  471.  
  472.                   Important Note for Borland Users:
  473.  
  474.      You Must set the -Fs compiler option.  This tells the compiler
  475. to assume that the Stack Segment equals the Data Segment.  In the
  476. Programmers IDE, you go to Options / Compiler / Code Generation and
  477. select "Always" under the option "Assume SS Equals DS".
  478.      Why?  Because I compiled the TIFF256 Extensions with the -Fs
  479. option set for compatibility with VSA256 Graphics Library.  Why did I
  480. compile VSA256 with the -Fs option?  See the VSA256 documentation,
  481. section 2.3 if you really must know.
  482.  
  483.  
  484. 2.4 Support of TIFF 5.0
  485.  
  486.      For the programmer familiar with the TIFF 5.0 Technical
  487. Memorandum, the following list indicate which and to what degree the
  488.                                 
  489.                                 
  490.                                 
  491.                                 
  492.                                 
  493.                                 
  494.                                 Page: 9
  495.                                    
  496. defined tags are supported by the TIFF256 Extensions.  The tags
  497. supported provide functionality with most images.  When in doubt, run
  498. the provided TIF_DATA program to determine the characteristics of a
  499. given TIFF file.
  500.  
  501. TAGS SUPPORTED:
  502.  
  503. Basic Tags -
  504.           BitsPerSample = 8,8,8 (for RGB or True Color Images)
  505.           BitsPerSample <= 8 (for Bilevel, Grayscale, or Palette
  506.           images)
  507.           ColorMap
  508.           Compression = none
  509.           ImageLength
  510.           ImageWidth
  511.           NewSubFileType
  512.           PhotometricInterpretation = Bilevel and Grayscale
  513.           PhotometricInterpretation = RGB (True Color)
  514.           PhotometricInterpretation = Palette Color
  515.           PlanarConfiguration = 1
  516.           ResolutionUnit
  517.           RowsPerStrip
  518.           SamplesPerPixel
  519.           StripByteCounts
  520.           StripOffsets
  521.           XResolution
  522.           YResolution
  523.           
  524. TAGS NOT SUPPORTED (Maybe Next Revision):
  525.  
  526. Basic Tags -
  527.           BitsPerSample != 8,8,8 (for RGB or True Color Images)
  528.           BitsPerSample > 8 (for Bilevel, Grayscale, or Palette
  529.           images)
  530.           ColorResponseCurves
  531.           Compression = CCITT Group 3 1-Dimensional Modified Huffman
  532.           RLE
  533.           Compression = LZW Compression
  534.           Compression = PackBits Compression
  535.           GrayResponseCurve
  536.           GrayResponseUnit
  537.           PhotometricInterpretation = Transparency Mask
  538.           PlanarConfiguration = 2
  539.           Predictor
  540.                                 
  541.                                 
  542.                                 
  543.                                 
  544.                                 
  545.                                 
  546.                                 
  547.                                 
  548.                                 
  549.                                 Page: 10
  550.                                    
  551. TAGS NOT SUPPORTED (continued):
  552.  
  553. Informational Tags -
  554.           Artist
  555.           DateTime
  556.           HostComputer
  557.           ImageDescription
  558.           Make
  559.           Model
  560.           Software
  561.           
  562. Facsimile Tags -
  563.           Group3Options
  564.           Group4Options
  565.           
  566. Document Storage and Retrieval Tags -
  567.           DocumentName
  568.           PageName
  569.           PageNumber
  570.           XPosition
  571.           YPosition
  572.           
  573. Obsolete Tags -
  574.           CellLength
  575.           CellWidth
  576.           FillOrder
  577.           FreeByteCounts
  578.           FreeOffsets
  579.           MaxSampleValue
  580.           MinSampleValue
  581.           SubFileType
  582.           Orientation
  583.           Thresholding
  584.  
  585.  
  586.                                 
  587.                                 
  588.                                 
  589.                                 
  590.                                 
  591.                                 
  592.                                 
  593.                                 
  594.                                 
  595.                                 
  596.                                 
  597.                                 
  598.                                 
  599.                                 
  600.                                 
  601.                                 
  602.                                 
  603.                                 
  604.                                 Page: 11
  605.                                    
  606. 3.0 TIFF256 Extensions Functionality
  607.  
  608.      This section describes the operation of the TIFF256 Extensions.
  609. To use the functions in this library, compile your program using the
  610. Large Memory Model and link your program with the appropriate
  611. libraries listed below depending on the compiler being used.
  612.  
  613.      Microsoft C or Quick C   -    VSA256MS.LIB and TIFFMSL.LIB
  614.      Borland C++ or Turbo C   -    VSA256BC.LIB and TIFFBCL.LIB
  615.  
  616. 3.1 Handling The Color Look Up Table
  617.  
  618.      The TIFF256 Extensions supports Bilevel and 8 bit or less
  619. Grayscale images (TF_PhotometricInterpretation = 1), 24 bit True
  620. Color images (TF_PhotometricInterpretation = 2) and 8 bit or less
  621. Palette Color images (TF_PhotometricInterpretation = 3).
  622.      Since this library is specifically designed for hardware with
  623. 256 entry Color Look Up Tables (CLUTs), 24 bit True Color images are
  624. reduced to 8 bit images.  The method of reduction is selectable as
  625. either 332-RGB, Dithered, or Adaptive Palette .  With the 332-RGB method, 
  626. the Red, Green, and Blue color components are compressed to 8 bit pixels
  627. consisting of 3 bits Red, 3 bits Green, and 2 bits Blue, and the CLUT
  628. is loaded with a compressed True Color palette.  The Dithered method also 
  629. loads a compressed True Color palette, but the pixel intensities are 
  630. modulated (or dithered) in a technique which approximates all of the 16 
  631. million possible colors.  With the Adaptive Palette method each 24 bit 
  632. image is analyzed separately.  The optimal color palette is determined for 
  633. the image and loaded into the Color Look Up Table (see section 3.2.1 
  634. 'tf_set_true_color_mode' function for details).
  635.      For Palette Color images, the IFD comes with its own values
  636. which are directly loaded into the CLUT.
  637.      Regardless of image type, the CLUT is not loaded until
  638. 'tf_display_ifd' (section 3.2.9) is called, even though the IFD may
  639. have already been read by 'tf_read_ifd' (section 3.2.8).  This means
  640. that the previously loaded CLUT (typically from previously displayed
  641. IFD) remains in force until 'tf_display_ifd' is called.  When using,
  642. 'tf_load_image' (section 3.2.12) instead of 'tf_display_ifd', the
  643. CLUT is not loaded until the program deems appropriate with a call to
  644. 'vsa_write_color_block'.
  645.  
  646.                                 
  647.                                 
  648.                                 
  649.                                 
  650.                                 
  651.                                 
  652.                                 
  653.                                 
  654.                                 
  655.                                 
  656.                                 
  657.                                 
  658.                                   
  659.                                 Page: 12
  660.                                    
  661. 3.2 Function Descriptions
  662.  
  663.      In the following sections each function is listed along with a
  664. definition of its inputs and return values.  A description is
  665. provided followed by any relevant comments.
  666.  
  667. 3.2.1 tf_set_true_color_mode(mode,num_colors,quality)
  668.  
  669. Inputs:   int mode, num_colors, quality;
  670.  
  671. Returns:  Nothing
  672.  
  673. Description:   This routine configures the way that 24 bit/pixel True 
  674.           Color images are displayed.  When reading an image from an IFD, 
  675.           the 'tf_display_ifd' and 'tf_load_image' routines automatically
  676.           detect the number of bits per pixel and convert the image to 8 
  677.           bits per pixel.  If the image in the IFD is a 24 bit per pixel 
  678.           image, the conversion process is defined by the 
  679.           'tf_set_true_color_mode' routine.
  680.                24 bit True Color images are reduced to 8 bit images using 
  681.           either the 332-RGB, Dithered, or Adaptive Palette method.  When 
  682.           'mode' = 0, the 332-RGB method is used.  The Red, Green, and Blue 
  683.           color components are compressed to 8 bit pixels consisting of 3 
  684.           bits Red, 3 bits Green, and 2 bits Blue, and the Color Look Up 
  685.           Table is loaded with a compressed True Color palette.  When 
  686.           'mode' = 1, the Dithered method is used.  Again a True Color 
  687.           palette is loaded, but the pixel intensities are modulated (or 
  688.           dithered) in a technique which approximates all of the 16 million 
  689.           possible colors.  When 'mode' = 2, the Adaptive Palette method is 
  690.           used.  In this case each 24 bit image is analyzed separately.  
  691.           The optimal color palette is determined for the image and loaded 
  692.           into the Color Look Up Table.
  693.               The Adaptive Palette method reduces the 16 million possible 
  694.           colors in the 24 bit image down to 'num_colors', where 'num_colors' 
  695.           can range from 2 to 256.  The 'quality' parameter lets the user 
  696.           optimize the Adaptive Palette algorithm for image quality.  The 
  697.           valid range is from 0 to 100.  When 'quality' is closer to 0, the 
  698.           algorithm is optimized for images with fewer colors, but many 
  699.           shades per color (smooth shading is emphasized at the expense of 
  700.           color variety).  When 'quality' is closer to 100, the algorithm
  701.           is optimized for images with a broader color distribution (many 
  702.           colors are accommodated at the expense of smooth shading).  If 
  703.           'mode' is not 2, the 'num_colors' and 'quality' parameters are
  704.           ignored.
  705.  
  706. Availability:  In TIFF256 Graphics Library Version 3.0 and up.
  707.  
  708.                                 
  709.                                 
  710.                                 
  711.                                 
  712.                                 
  713.                                 
  714.                                 Page: 13
  715.                                    
  716. 3.2.2 tf_get_true_color_mode(pmode,pnum_colors,pquality)
  717.  
  718. Inputs:   int *pmode,*num_colors,*pquality;
  719.  
  720. Returns:  Nothing
  721.  
  722. Description:   This routine returns the current True Color display mode 
  723.           and the Adaptive Palette configuration parameters which were 
  724.           set by 'tf_set_true_color_mode'.  '*pmode' returns the True 
  725.           Color display 'mode' value, '*pnum_colors' returns the Adaptive 
  726.           Palette 'num_colors'  value, and '*pquality' returns the 
  727.           Adaptive Palette 'quality' value.
  728.  
  729. Availability:  In TIFF256 Graphics Library Version 3.0 and up.
  730.  
  731. 3.2.3 tf_open_file(filename)
  732.  
  733. Inputs:   char far filename[];
  734.  
  735. Returns:  int fail_flag;
  736.  
  737. Description:   This routine opens the TIFF file specified by the
  738.           character string 'filename[]' for use by the TIFF256
  739.           Extensions.  Only one file can be opened at a time.  The
  740.           file is opened as 'Read Only'.  If the file is successfully
  741.           opened, this routine returns a '0'.  Otherwise, it returns
  742.           a '-1'.  This routine must be called before calling
  743.           tf_get_file_info().
  744.  
  745. Availability:  In TIFF256 Graphics Library Version 1.0 and up.
  746.  
  747. 3.2.4 tf_close_file()
  748.  
  749. Inputs:   Nothing
  750.  
  751. Returns:  Nothing
  752.  
  753. Description:   This routine closes the currently open TIFF file.
  754.           This routine must be called before opening a new TIFF file
  755.           with tf_open_file().  This routine should be called before
  756.           exiting your program.
  757.  
  758. Availability:  In TIFF256 Graphics Library Version 1.0 and up.
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.                                 Page: 14
  770.                                    
  771. 3.2.5 tf_get_file_info()
  772.  
  773. Inputs:   Nothing
  774.  
  775. Returns:  int fail_flag;
  776.  
  777. Description:     This routine verifies that the
  778.           selected file is a TIFF format file.  Then it initializes
  779.           the TIFF256 environment for this file.  The global
  780.           parameter 'TF_Num_Ifd' is set to the number of Image File
  781.           Directories (IFDs) existing within the file.    An IFD is
  782.           one 'picture', and multiple IFDs can exist within one TIFF
  783.           file.  The TIFF file pointer is set to point to the first
  784.           IFD in the file.  This routine is typically called after
  785.           'tf_open_file'.  The 'fail_flag' is returned with one of
  786.           the following values:
  787.  
  788.                  0  No Errors
  789.                  1  Error, Reading file failed
  790.                  2  Error, File shorter than expected
  791.                  3  Error, Bad TIFF File
  792.  
  793.  
  794. Availability:  In TIFF256 Graphics Library Version 1.0 and up.
  795.  
  796. Comments: The 'fail_flag' return values 2 and 3 have been added as of
  797.           Version 3.0.
  798.  
  799. 3.2.6 tf_skip_ifd(count)
  800.  
  801. Inputs:   unsigned count;
  802.  
  803. Returns:  int reached_end;
  804.  
  805. Description:   This routine moves the TIFF file pointer ahead 'count'
  806.           IFDs. Typically, this routine is called after
  807.           tf_get_file_info() to index the TIFF file pointer to the
  808.           desired IFD.  For example, if tf_get_file_info() sets
  809.           TF_Num_Ifd to 5, calling this routine immediately after
  810.           tf_get_file_info() with 'count' = 3, will cause the TIFF
  811.           file pointer to skip over the first 3 IFDs and point to the
  812.           4th IFD.  If 'count' equals or exceeds the number of
  813.           remaining IFDs, this routine returns a 1, and the TIFF file
  814.           pointer is set to point to the last IFD.  Otherwise it
  815.           returns a 0.
  816.  
  817. Availability:  In TIFF256 Graphics Library Version 1.0 and up.
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.                                 Page: 15
  825.                                    
  826. 3.2.7 tf_set_defaults()
  827.  
  828. Inputs:   Nothing
  829.  
  830. Returns:  Nothing
  831.  
  832. Description:                                 This routine sets the
  833.           default values for all of the global parameters which are
  834.           modified by TIFF 'Tags'.  TIFF files may not include data
  835.           for all of the parameters used by the TIFF256 environment,
  836.           and therefore the defaults should be set.  This routine
  837.           should be called at the beginning of each new IFD, prior to
  838.           calling tf_read_ifd().  The default values are listed
  839.           below:
  840.  
  841.                TF_ImageWidth                 =    0
  842.                TF_ImageLength                =    0
  843.                TF_BitsPerSample[0]           =    1
  844.                TF_BitsPerSample[1]           =    1
  845.                TF_BitsPerSample[2]           =    1
  846.                TF_ResolutionUnit             =    2
  847.                TF_SamplesPerPixel            =    1
  848.                TF_PhotometricInterpretation  =    1
  849.                TF_XResolution_int            =    300
  850.                TF_XResolution_frac           =    1
  851.                TF_YResolution_int            =    300
  852.                TF_YResolution_frac           =    1
  853.                
  854. Availability:  In TIFF256 Graphics Library Version 1.0 and up.
  855.  
  856. 3.2.8 tf_read_ifd()
  857.  
  858. Inputs:   Nothing
  859.  
  860. Returns:  int fail_flag;
  861.  
  862. Description:     This routine reads the data
  863.           from the IFD currently pointed to by the TIFF file pointer.
  864.           The TIFF file pointer must be pointing to a valid IFD prior
  865.           to calling this routine (This routine is typically called
  866.           after 'tf_open_file' or 'tf_skip_ifd' which initialize the
  867.           pointer).  After reading the data from the current IFD, the
  868.           TIFF file pointer is set to point to the next IFD.  If the
  869.           TIFF file pointer points to the last IFD in the TIFF file
  870.           and this routine is executed, the IFD is read, and then the
  871.           TIFF file pointer is set with a null value.  After calling
  872.           this routine, 'tf_display_ifd' or 'tf_load_image' can be
  873.           called to display the IFD's image.  The 'fail_flag' is
  874.           returned with one of the following values:
  875.  
  876.                                 
  877.                                 
  878.                                 
  879.                                 Page: 16
  880.                                    
  881.                 0  No Errors
  882.                 1  Error, TIFF file pointer is a null value, end of file
  883.                 2  Error, Seeking in File
  884.                 3  Error, Reading file failed
  885.                 4  Greater than 8 Bit Palette Pixels Not Supported
  886.                 5  Samples Per Pixel > 3 Not Supported
  887.                 6  Only 8x8x8 Bit True Color Pixels Supported
  888.                 7  Compressed TIFF data Not Supported
  889.                 8  This Photometric Interpretation Not Supported
  890.                 9  Currently Only Support up to 1024 Strips
  891.                10  Samples Per Pixel > 3 Not Supported
  892.                11  Currently Only Support up to 1024 Strips
  893.                12  This Planar Configuration Not Supported
  894.                13  This Predictor Not Supported
  895.                14  Color Map Size > 256 Not Supported
  896.  
  897.           The following global parameters are set by this routine:
  898.  
  899.                     TF_ImageWidth
  900.                     TF_ImageLength
  901.                     TF_BitsPerSample[3]
  902.                     TF_ResolutionUnit
  903.                     TF_SamplesPerPixel
  904.                     TF_PhotometricInterpretation
  905.                     TF_XResolution_int
  906.                     TF_XResolution_frac
  907.                     TF_YResolution_int
  908.                     TF_YResolution_frac
  909.  
  910. Availability:  In TIFF256 Graphics Library Version 1.0 and up.
  911.  
  912. Comments: The 'fail_flag' return values 2 through 14 have been added
  913.           as of Version 3.0.
  914.  
  915. 3.2.9 tf_display_ifd(x0,y0)
  916.  
  917. Inputs:   unsigned x0;
  918.           unsigned y0;
  919.  
  920. Returns:  int fail_flag;
  921.  
  922. Description:   This routine displays the image that is defined in the
  923.           IFD read by the most recent call to 'tf_read_ifd'.  The
  924.           image is drawn directly to the screen with its top left
  925.           corner at screen coordinates 'x0,y0'.  The Color Look Up
  926.           Table is not modified until this routine is executed.  When
  927.           executed, this routine prepares the Color Look Up Table as
  928.                                 
  929.                                 
  930.                                 
  931.                                 
  932.                                 
  933.                                 
  934.                                 Page: 17
  935.                                    
  936.           defined by the IFD being displayed.  Before calling this
  937.           routine, 'tf_read_ifd' must be called to initialize all of
  938.           the required parameters.
  939.               When reading the image in the IFD, this routine
  940.           automatically detects the number of bits per pixel and
  941.           converts the image to 8 bits per pixel.  If the image in
  942.           the IFD is a 24 bit per pixel image, the conversion process
  943.           is defined by the 'tf_set_true_color_mode' routine.
  944.               If Adaptive Palette is enabled (via
  945.           'tf_set_true_color_mode'), this routine temporarily
  946.           allocates 32k bytes of memory for the Adaptive Palette
  947.           conversion process.  If the allocation fails, this routine
  948.           returns a fail_flag = 1, otherwise 0 is returned.  In the
  949.           case where the allocation fails, the program can disable
  950.           Adaptive Palette and call this routine again.
  951.               Typically this routine is used instead of
  952.           'tf_load_image' when you don't need to store the image in a
  953.           buffer for subsequent manipulation.  This routine also
  954.           useful when the run time environment has insufficient
  955.           memory for allocating the huge image memory buffer used
  956.           with 'tf_load_image'.
  957.  
  958. Availability:  In TIFF256 Graphics Library Version 1.0 and up.
  959.  
  960. Comments: This routine may be called more than once per 'tf_read_ifd'
  961.           call.  Please DO NOT call this routine if 'tf_read_ifd'
  962.           returns an error (fail_flag = 1).
  963.  
  964. 3.2.10 tf_save_file(x0,y0,x1,y1,filename)
  965.  
  966. Inputs:   unsigned x0,y0,x1,y1;
  967.           char far filename[];
  968.  
  969. Returns:  int fail_flag;
  970.  
  971. Description:   This routine saves the portion of the screen image
  972.           defined by (x0,y0) (x1,y1) to the TIFF file "filename". The
  973.           image is saved as an 8 bit Palette Color image (i.e. 8
  974.           bits/pixel).  This routine may be called at anytime after
  975.           vsa_init is called.  If an error occurs in writing the
  976.           file, a -1 is returned, otherwise 0 is returned.
  977.                The TIFF image file saved as a result of this routine
  978.           has the following characteristics, as defined by the TIFF
  979.           specification:
  980.  
  981.                  - Intel Byte Ordering
  982.                  - SamplesPerPixel = 1
  983.                  - BitsPerSample = 8 (i.e. 8 bits per pixel)
  984.                  - ColorMap (i.e. Color palette stored within TIFF file)
  985.                  - PhotometricInterpretation = Palette Color
  986.                  - PlanarConfiguration = 1
  987.                  - RowsPerStrip = 1
  988.                  - ImageWidth = |x1-x0|+1 (pixels)
  989.                                 Page: 18
  990.                                    
  991.                  - ImageLength = |y1-y0|+1 (pixels)
  992.                  - Resolution Unit = 2 (inches)
  993.                  - XResolution = 100 (Dots Per Inch)
  994.                  - YResolution = 100 (Dots Per Inch)
  995.                  - Compression = none
  996.  
  997. Availability:  In TIFF256 Graphics Library Version 2.0 and up.
  998.  
  999. 3.2.11 tf_image_size()
  1000.  
  1001. Inputs:   Nothing
  1002.  
  1003. Returns:  long size;
  1004.  
  1005. Description:   This routine returns the size (in bytes) of the memory
  1006.           buffer required to store an image that is defined in the
  1007.           IFD read by the most recent call to 'tf_read_ifd'.  Before
  1008.           calling this routine, 'tf_read_ifd' must be called to
  1009.           define all of the required global parameters.  The size is
  1010.           based on 8 bit pixels regardless of the image type since
  1011.           'tf_load_image' always converts to 8 bit pixels as it reads
  1012.           the TIFF file.  The size returned is equal to the number of
  1013.           pixels in the image plus 4.
  1014.               Typically, after calling 'tf_image_size, a 'huge'
  1015.           memory buffer is allocated with 'size' bytes.  Then the
  1016.           'tf_load_image'  function is used to load the image from
  1017.           the TIFF file into the memory buffer.
  1018.  
  1019. Availability:  In TIFF256 Graphics Library Version 3.0 and up.
  1020.  
  1021. Comments: This routine may be called more than once per 'tf_read_ifd'
  1022.           call.  Please DO NOT call this routine if 'tf_read_ifd'
  1023.           returns an error (fail_flag = 1).
  1024.  
  1025. 3.2.12 tf_load_image(image,lut)
  1026.  
  1027. Inputs:        unsigned char huge *image;
  1028.                unsigned char far *lut;
  1029.  
  1030. Returns:  int colors;
  1031.  
  1032. Description:   This routine loads the 'image' memory buffer with the
  1033.           image that is defined in the IFD read by the most recent
  1034.           call to 'tf_read_ifd'.  The images color palette is loaded
  1035.           into the 'lut' memory buffer.  The 'image' memory buffer
  1036.           must be allocated the size returned by 'tf_image_size', and
  1037.           the 'lut' memory must be allocated 768 bytes before calling
  1038.           this routine.  The return value 'colors' indicates how many
  1039.           of the 256 colors in 'lut' are actually used (0 or 1
  1040.           indicates an error).  Before calling this routine,
  1041.           'tf_read_ifd' must be called to initialize all of the
  1042.           required parameters.
  1043.                                 
  1044.                                 Page: 19
  1045.                                    
  1046.               When reading the image in the IFD, this routine
  1047.           automatically detects the number of bits per pixel and
  1048.           converts the image to 8 bits per pixel.  If the image in
  1049.           the IFD is a 24 bit per pixel image, the conversion process
  1050.           is defined by the 'tf_set_true_color_mode' routine.
  1051.               If Adaptive Palette is enabled (via
  1052.           'tf_set_true_color_mode'), this routine temporarily
  1053.           allocates 32k bytes of memory for the Adaptive Palette
  1054.           conversion process.  If the allocation fails, this routine
  1055.           returns a fail_flag = 1.  In the case where the allocation
  1056.           fails, the program can disable Adaptive Palette and call
  1057.           this routine again.
  1058.               The 'image' buffer can be displayed on the screen with
  1059.           the 'vsa_put_image' function, or saved to a TIFF file with
  1060.           the 'tf_save_image' function.  The color palette in the
  1061.           'lut' buffer can be loaded into the Color Look Up Table
  1062.           using the 'vsa_write_color_block' routine.
  1063.               The 'image' buffer stores the image width in the first
  1064.           two bytes, the  image height in the second two bytes, and
  1065.           then the image pixels in raster order (row, then column).
  1066.           The first pixel value following image height is the top
  1067.           left corner pixel.  The 'lut' array stores the 256 color
  1068.           palette data in RGB triplets where each of R, G, and B is a
  1069.           byte.  768 triplets are stored in 'lut'.
  1070.               Typically this routine is used instead of
  1071.           'tf_display_ifd' when you need to store the image in a
  1072.           buffer for subsequent manipulation.  With this routine, a
  1073.           program can bring in an image, manipulate its pixels and or
  1074.           color palette, and then save it back to a TIFF file without
  1075.           ever necessarily having to display the image on the screen.
  1076.  
  1077. Availability:  In TIFF256 Graphics Library Version 3.0 and up.
  1078.  
  1079. Comments: This routine may be called more than once per 'tf_read_ifd'
  1080.           call.  Please DO NOT call this routine if 'tf_read_ifd'
  1081.           returns an error (fail_flag = 1).
  1082.  
  1083. 3.2.13 tf_save_image(image,lut,filename)
  1084.  
  1085. Inputs:   unsigned char huge *image;
  1086.           unsigned char far *lut;
  1087.           char filename[];
  1088.  
  1089. Returns:  int fail_flag;
  1090.  
  1091. Description:   This routine saves the image defined in the 'image'
  1092.           buffer along with the 256 color palette defined in the
  1093.           'lut' buffer to the TIFF file "filename". The image is
  1094.           saved as an 8 bit Palette Color image (i.e. 8 bits/pixel).
  1095.           This routine may be called at anytime after vsa_init is
  1096.           called, assuming that both 'image' and 'lut' have been
  1097.           loaded with meaningful data..  If an error occurs in
  1098.           writing the file, a -1 is returned, otherwise 0 is returned.
  1099.                                 Page: 20
  1100.                                    
  1101.               The 'image' buffer could have been loaded through
  1102.           either a 'tf_load_image' (which gets it from a TIFF file)
  1103.           or through 'vsa_get_image' (which gets it directly from the
  1104.           screen).  In the latter case, you would also need to have
  1105.           loaded the 'lut' buffer using 'vsa_read_color_block'.
  1106.               The 'image' array stores the image width in the first
  1107.           two bytes, the image height in the second two bytes, and
  1108.           then the image pixels in standard raster order (row, then
  1109.           column). First pixel is in top left corner.  The 'lut'
  1110.           array stores the 256 color palette data in RGB triplets
  1111.           where each of R, G, and B is a byte.  256 triplets (768 bytes)
  1112.           are stored in 'lut'.
  1113.               The TIFF image file saved as a result of this routine
  1114.           has the following characteristics, as defined by the TIFF
  1115.           specification:
  1116.                 - Intel Byte Ordering
  1117.                 - SamplesPerPixel = 1
  1118.                 - BitsPerSample = 8 (i.e. 8 bits per pixel)
  1119.                 - ColorMap (i.e. Color palette stored within TIFF file)
  1120.                 - PhotometricInterpretation = Palette Color
  1121.                 - PlanarConfiguration = 1
  1122.                 - RowsPerStrip = 1
  1123.                 - ImageWidth = first 16 bits of 'image' buffer
  1124.                 - ImageLength = second 16 bits of 'image' buffer
  1125.                 - Resolution Unit = 2 (inches)
  1126.                 - XResolution = 100 (Dots Per Inch)
  1127.                 - YResolution = 100 (Dots Per Inch)
  1128.                 - Compression = none
  1129.  
  1130. Availability:  In TIFF256 Graphics Library Version 3.0 and up.
  1131.  
  1132. 3.2.14 tf_set_prime_colors()
  1133.  
  1134. Inputs:   Nothing
  1135.  
  1136. Returns:  Nothing
  1137.  
  1138. Description:   This routine updates the prime color global
  1139.           parameters: TF_Black, TF_Red, TF_Orange, TF_Yellow,
  1140.           TF_Green, TF_Aqua, TF_Blue, TF_Violet, and TF_White.  It
  1141.           does this by scanning the Color Look Up Table and loading
  1142.           each parameter with the Color Look Up Table index for the
  1143.           brightest color nearest to the color specified by the
  1144.           parameter name.  This routine should be called following
  1145.           any operation which modifies the Color Look Up Table (such
  1146.           as tf_display_ifd).
  1147.                The prime color global parameters are provided in an
  1148.           attempt to give the user access to a standard set of colors
  1149.           (for use with text, borders, etc.) regardless of Color Look
  1150.           Up Table operations.  However, the color must exist in the
  1151.           Color Look Up Table for this routine to find it.
  1152.  
  1153. Availability:  In TIFF256 Graphics Library Version 1.0 and up.
  1154.                                 Page: 21
  1155.                                    
  1156. 4.0 Nitty Gritties
  1157.  
  1158. 4.1 Registration Information
  1159.  
  1160.      If you find the TIFF256 Graphics Library Extensions useful, a
  1161. registration of $29 would be appreciated ($15 if ordering VSA256 and
  1162. TIFF256 at the same time, see ORDER.TXT).  Registration brings with
  1163. it MAJOR BENEFITS, as spelled out in section 1.2, so look at the
  1164. ORDER.TXT file and fill it out!
  1165.  
  1166.           Please fill out the Information About You and the Wish List
  1167. sections, and indicate the version number of the software you are
  1168. presently using.  Send check or money order to:
  1169.  
  1170.                              Spyro Gumas
  1171.                        1668 Shady Brook Drive
  1172.                         Fullerton, Ca. 92631
  1173.                                   
  1174.  
  1175.                                 
  1176.                                 
  1177.                                 
  1178.                                 
  1179.                                 
  1180.                                 
  1181.                                 
  1182.                                 
  1183.                                 
  1184.                                 
  1185.                                 
  1186.                                 
  1187.                                 
  1188.                                 
  1189.                                 
  1190.                                 
  1191.                                 
  1192.                                 
  1193.                                 
  1194.                                 
  1195.                                 
  1196.                                 
  1197.                                 
  1198.                                 
  1199.                                 
  1200.                                 
  1201.                                 
  1202.                                 
  1203.                                 
  1204.                                 
  1205.                                 
  1206.                                 
  1207.                                 
  1208.                                 
  1209.                                 Page: 22
  1210.                                    
  1211. 4.2 Software License
  1212.  
  1213.                 TIFF256 Graphics Library, Version 3.0
  1214.       Copyright Spyro Gumas, 1992 - 1994.  All Rights Reserved.
  1215.  
  1216.      The TIFF256 Graphics Library Extensions is a "shareware program"
  1217. and is provided at no charge to the user for evaluation.  The essence
  1218. of  "user-supported" software is to provide personal  computer  users
  1219. with  quality  software  without high  prices,  and  yet  to  provide
  1220. incentive  for programmers to continue to develop new  products.   If
  1221. you  find this program useful and find that you are using The TIFF256
  1222. Graphics  Library Extensions and continue to use The TIFF256 Graphics
  1223. Library Extensions after a reasonable trial period, you must  make  a
  1224. registration  payment of $29 to Spyro Gumas ($15 if  ordering  VSA256
  1225. and  TIFF256 at the same time, see ORDER.TXT).  The registration  fee
  1226. will  license one copy for use on any one computer at any  one  time.
  1227. You  must treat this software just like a book.  An example  is  that
  1228. this  software may be used by any number of people and may be  freely
  1229. moved  from one computer location to another, so long as there is  no
  1230. possibility of it being used at one location while it's being used at
  1231. another.  Just as a book cannot be read by two different  persons  at
  1232. the same time.
  1233.  
  1234. You are free (and encouraged) to copy and distribute The TIFF256
  1235. Graphics Library Extensions if:
  1236.  
  1237. 1)   It is not used as a component of another software library.
  1238. 2)   No fee is charged for use, copying or distribution.
  1239. 3)   It is distributed as is (preferably as TIF256.ZIP) and not
  1240.      modified in any way.
  1241.  
  1242. Furthermore, you are granted royalty free use of The TIFF256 Graphics
  1243. Library Extensions executable code in any of your programs given
  1244. that:
  1245.  
  1246. 1)   You have registered your use of The TIFF256 Graphics Library
  1247.      Extensions and paid the registration fee.
  1248. 2)   It is not used as a component of another software library.
  1249. 3)   You visibly acknowledge the use of The TIFF256 Graphics Library
  1250.      Extensions in  your product in both the printed materials and the
  1251.      executable software with the following statement:
  1252.  
  1253.      "This software uses the VSA256 and TIFF256 Graphics Libraries,
  1254.       Copyright Spyro Gumas, 1992 - 1994.  All Rights Reserved"
  1255.  
  1256.  
  1257.       Clubs  and user groups may charge a nominal fee (not to  exceed
  1258. $10)  for  expenses  and  handling  while  distributing  The  TIFF256
  1259. Graphics   Library  Extensions.   Anyone  distributing  The   TIFF256
  1260. Graphics  Library Extensions for any kind of remuneration must  first
  1261.                                 
  1262.                                 
  1263.                                 
  1264.                                 Page: 23
  1265.                                    
  1266. contact  Spyro  Gumas  at the address below for  authorization.  This
  1267. authorization   will   be  automatically  granted   to   distributors
  1268. recognized  by the (ASP) as adhering to its guidelines for  shareware
  1269. distributors,  and such distributors may begin offering  The  TIFF256
  1270. Graphics  Library  Extensions immediately (However Spyro  Gumas  must
  1271. still be advised so that the distributor can be kept up-to-date  with
  1272. the latest version of The TIFF256 Graphics Library Extensions.).
  1273.  
  1274.      Commercial users of The TIFF256 Graphics Library Extensions must
  1275. register  and  pay  for their copies of The TIFF256 Graphics  Library
  1276. Extensions within 30 days of first use or their license is withdrawn.
  1277. Consult  the  file  ORDER.TXT for more information or  contact  Spyro
  1278. Gumas.
  1279.  
  1280. 4.3 Disclaimer
  1281.  
  1282.      Users of The TIFF256 Graphics Library Extensions must accept
  1283. this  disclaimer of warranty:  The TIFF256 Graphics Library
  1284. Extensions is supplied as is.  The author disclaims all warranties,
  1285. expressed or implied, including, without limitation, the warranties
  1286. of merchantability and of fitness for any purpose. The author assumes
  1287. no liability for damages, direct or consequential, which may result
  1288. from the use of The TIFF256 Graphics Library Extensions.  In no event
  1289. shall the author's liability for any damages ever exceed the price
  1290. paid for the license to use The TIFF256 Graphics Library Extensions,
  1291. regardless of the form of the claim.  The person using The TIFF256
  1292. Graphics Library Extensions bears all risk as to the quality and
  1293. performance of this software.
  1294.  
  1295. 4.4 Technical Support
  1296.  
  1297.      If you have any questions or comments about The TIFF256 Graphics
  1298. Library Extensions, please write me at:
  1299.  
  1300.                              Spyro Gumas
  1301.                        1668 Shady Brook Drive
  1302.                         Fullerton, Ca. 92631
  1303.  
  1304. Or, contact me on EMAIL!
  1305.  
  1306.             CompuServ  71064,1571
  1307.             Internet:  71064.1571@compuserve.com
  1308.  
  1309.  
  1310.                                 
  1311.                                 
  1312.                                 
  1313.                                 
  1314.                                 
  1315.                                 
  1316.                                 
  1317.                                 
  1318.                                 
  1319.                                 Page: 24
  1320.                                    
  1321. 5.0 Appendix
  1322.  
  1323. 5.1 TIFF.H Include File
  1324.  
  1325. /*................................. TIFF.H ................ 7-28-94 ........*/
  1326. /* This file declares the TIFFLB library functions and global parameters    */
  1327. /* used throughout the graphics routines (Version 3.0).                     */
  1328. /*                                                                          */
  1329. /*       Copyright Spyro Gumas, 1992 - 1994.  All Rights Reserved.          */
  1330. /*..........................................................................*/
  1331.  
  1332. /*.... The next line is for compatibility with older versions of TIFF256 ...*/
  1333. #define tf_display_image tf_display_ifd
  1334.  
  1335. /*..........................................................................*/
  1336. /*                          Function Prototypes                             */
  1337. /*..........................................................................*/
  1338. extern void far cdecl tf_set_true_color_mode(int, int, int);
  1339. extern void far cdecl tf_get_true_color_mode(int far *, int far *,
  1340.                                              int far *);
  1341. extern int  far cdecl tf_open_file(char far *);
  1342. extern void far cdecl tf_close_file(void);
  1343. extern int  far cdecl tf_get_file_info(void);
  1344. extern int  far cdecl tf_skip_ifd(unsigned);
  1345. extern void far cdecl tf_set_defaults(void);
  1346. extern int  far cdecl tf_read_ifd(void);
  1347. extern int  far cdecl tf_display_ifd(unsigned,unsigned);
  1348. extern int  far cdecl tf_save_file(unsigned,unsigned,unsigned,unsigned,
  1349.                                    char far *);
  1350. extern long far cdecl tf_image_size(void);
  1351. extern int  far cdecl tf_load_image(unsigned char huge*,unsigned char
  1352.                                     far*);
  1353. extern int  far cdecl tf_save_image(unsigned char huge*,unsigned char
  1354.                                     far*,char far *);
  1355. extern void far cdecl tf_set_prime_colors(void);
  1356.  
  1357. /*..........................................................................*/
  1358. /*                          Parameter Declarations                          */
  1359. /*..........................................................................*/
  1360.  
  1361. extern unsigned char far TF_Byte_Buf[4096];
  1362. extern unsigned long TF_ImageWidth, TF_ImageLength;
  1363. extern unsigned far TF_BitsPerSample[3],TF_Num_Ifd;
  1364. extern unsigned TF_ResolutionUnit,TF_SamplesPerPixel;
  1365. extern unsigned TF_PhotometricInterpretation;
  1366. extern unsigned long TF_XResolution_int,TF_XResolution_frac;
  1367. extern unsigned long TF_YResolution_int,TF_YResolution_frac;
  1368. extern unsigned TF_Black,TF_Red,TF_Orange,TF_Yellow,TF_Green;
  1369. extern unsigned TF_Aqua,TF_Blue,TF_Violet,TF_White;
  1370.  
  1371.  
  1372.                                 
  1373.                                 
  1374.                                 Page: 25
  1375.  
  1376.